/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.edu.psa.service;

import br.edu.psa.bussines.LivroBean;
import br.edu.psa.model.Livro;
import javax.ejb.EJB;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.ejb.Stateless;

/**
 *
 * @author JOAO
 */
@WebService(serviceName = "LivroWS")
@Stateless()
public class LivroWS {
    @EJB
    private LivroBean ejbRef;


    @WebMethod(operationName = "searchByName")
    public String searchByName(@WebParam(name = "name")
    String name) {
        String result = "";
        for(Livro l :ejbRef.searchByName(name)){
            result+="<Livro> \n <titulo>"+l.getTitulo()+"</titulo>";
            result+="\n<autor>"+l.getAutor()+"</autor>\n";
            result+="</Livro>";
        }
        return result;
    }
    
}
